package com.spring.shops.dao;

import com.spring.shops.model.entity.TzSysRoleMenu;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.DeleteMapping;

import java.util.List;

public interface TzSysRoleMenuMapper {
    int deleteByPrimaryKey(Long id);

    int insert(TzSysRoleMenu record);

    int insertSelective(TzSysRoleMenu record);

    TzSysRoleMenu selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(TzSysRoleMenu record);

    int updateByPrimaryKey(TzSysRoleMenu record);

    /**
     * 角色权限表中roleId等于当前id删除掉
     * @param roleId
     * @return
     */
    @Delete("delete from yami_shops.tz_sys_role_menu where role_id=#{roleId}")
    int deleteByRoleId(Long roleId);

    /**
     * 根据roleId获取角色权限表中的数据
     * @param roleId
     * @return
     */
    @Select("select menu_id from yami_shops.tz_sys_role_menu where role_id=#{roleId}")
    List<Integer> selectByRoleId(Long roleId);
}